package com.cole.gx095.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "admininfo")
public class Admininfo {
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    @Column(name = "Id")
    private int id;
    @Basic
    @Column(name = "AdminName")
    private String adminName;
    @Basic
    @Column(name = "AdminPwd")
    private String adminPwd;
    @Basic
    @Column(name = "TrueName")
    private String trueName;
    @Basic
    @CreatedDate
    @Column(name = "CreateDate")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp createDate;
    @Basic
    @CreatedDate
    @Column(name = "LastLoginDate")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp lastLoginDate;
    @Basic
    @CreatedDate
    @Column(name = "CurrentLoginDate")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp currentLoginDate;
    @Basic
    @Column(name = "RoleInfoId")
    private int roleInfoId;
    @Basic
    @Column(name = "Status")
    private Integer status;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getAdminName() {
        return adminName;
    }

    public void setAdminName(String adminName) {
        this.adminName = adminName;
    }

    public String getAdminPwd() {
        return adminPwd;
    }

    public void setAdminPwd(String adminPwd) {
        this.adminPwd = adminPwd;
    }

    public String getTrueName() {
        return trueName;
    }

    public void setTrueName(String trueName) {
        this.trueName = trueName;
    }

    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    public Timestamp getLastLoginDate() {
        return lastLoginDate;
    }

    public void setLastLoginDate(Timestamp lastLoginDate) {
        this.lastLoginDate = lastLoginDate;
    }

    public Timestamp getCurrentLoginDate() {
        return currentLoginDate;
    }

    public void setCurrentLoginDate(Timestamp currentLoginDate) {
        this.currentLoginDate = currentLoginDate;
    }

    public int getRoleInfoId() {
        return roleInfoId;
    }

    public void setRoleInfoId(int roleInfoId) {
        this.roleInfoId = roleInfoId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Admininfo admininfo = (Admininfo) o;
        return id == admininfo.id && roleInfoId == admininfo.roleInfoId && Objects.equals(adminName, admininfo.adminName) && Objects.equals(adminPwd, admininfo.adminPwd) && Objects.equals(trueName, admininfo.trueName) && Objects.equals(createDate, admininfo.createDate) && Objects.equals(lastLoginDate, admininfo.lastLoginDate) && Objects.equals(currentLoginDate, admininfo.currentLoginDate) && Objects.equals(status, admininfo.status);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, adminName, adminPwd, trueName, createDate, lastLoginDate, currentLoginDate, roleInfoId, status);
    }
}
